#!/usr/bin/env python

import unittest
import testcases
import HTMLTestRunner
import sys
import time
import os


BaseDir = '/usr/local/nginx/html/'



def get_save_path():
	now = time.localtime()
	dir = time.strftime('%Y%m%d',now)
	if not os.path.exists(BaseDir+dir):
		os.mkdir(BaseDir+dir)
	file = time.strftime('%H%M%S',now)
	return BaseDir+dir+'/'+'Report_'+file+'.html'

if __name__ == '__main__':


	suite = unittest.TestSuite()
	for s in testcases.suites:
		suite.addTest(unittest.defaultTestLoader.loadTestsFromName(s))

	fp = open('%s' %(get_save_path()),'wb')
	runner = HTMLTestRunner.HTMLTestRunner(stream=fp,title='REPORT',description='DESC')
	runner.run(suite)
	
